%option noyywrap batch

%{
#include "test.tab.h"
#include "common.h"
YY_BUFFER_STATE bp;
FILE *f;

%}
%%
"int"     { int a =3;  yylval.TYPE=copystr(yytext); printf("type input \"%s\"\n", yylval.TYPE);return TYPE;}
"float"     { int a =3; yylval.TYPE=copystr(yytext); return TYPE;}
[a-z]    {int b =3; yylval.ID=copystr(yytext);printf("tag input %s\n", yylval.TYPE); return ID;}
";"     {return END;}
"="     {return EUQL}
[ \t]    {}
\n    {return _N;}
","     { return yytext[0]; }
%%
void lexmain(){
    f = fopen("test.c", "r");
    bp = yy_create_buffer(f, YY_BUF_SIZE);
    yy_switch_to_buffer(bp);
}

